import numpy as np
import open3d as o3d

# 加载 .npy 文件
data = np.load('202504\\3dponits\\Area_5_office_11.npy')

# 创建 Open3D 点云对象e:\data\3DpointCloud\s3dis\trainval_fullarea\Area_5_office_11.npy
pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(data[:, :3])

# 如果有颜色信息
if data.shape[1] >= 6:
    pcd.colors = o3d.utility.Vector3dVector(data[:, 3:6] / 255.0)

# 保存为 PLY 文件
o3d.io.write_point_cloud('point_cloud.ply', pcd)
